<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\Link */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Links', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="link-view">

    <p>
        <?=  getReferUrlBtn() ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'name',
            'url:url',
            [
                'attribute' => 'logo',
                'format' => 'raw',
                'value' => getLogo($model)
            ],
            'create_at:datetime',
            'update_at:datetime',
            'order_num',
        ],
    ]) ?>

</div>

<?php 
function getLogo($model){
    $str = '<span style="color:red;">(未设置)</span>';
    if($model->logo){
        $str = '<img src="'.$model->logo.'" width="90" height="40"/>';
    }
    return $str;
}

?>